import java.util.Scanner;

class MyThread extends Thread {
    @Override
    public void  run() {
        while(true) {
            System.out.println("hello MyThread\n");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
public class DemoThread {
    public static void main(String[] args) {

        MyThread thread = new MyThread();
        thread.start();
       while(true){
           System.out.println("main Thread\n");
           try {
               Thread.sleep(1000);
           } catch (InterruptedException e) {
               throw new RuntimeException(e);
           }
       }


    }
}

